#include<iostream>
using namespace std;
#include<vector>
class Solution {
public:
    vector<int> resultsArray(vector<int>& nums, int k) {
        if (k == 1)
            return nums;
        int n = nums.size(), sum = 1;
        vector<int> ans(n - k + 1, -1);
        for (int i = 1; i < n; ++i) {
            if (nums[i] == nums[i - 1] + 1)
                ++sum;
            else
                sum = 1;
            if (i >= k - 1 && sum >= k)
                ans[i - k + 1] = nums[i];
        }
        return ans;
    }
};